namespace EntityFrameworkStudy.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class AddUser : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.C002", "C001Id", "dbo.C001");
            DropIndex("dbo.C002", new[] { "C001Id" });
            CreateTable(
                "dbo.Users",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Title = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            
            DropTable("dbo.C001");
            DropTable("dbo.C002");
        }
        
        public override void Down()
        {
            CreateTable(
                "dbo.C002",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Body = c.String(),
                        C001Id = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.C001",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Title = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            
            DropTable("dbo.Users");
            CreateIndex("dbo.C002", "C001Id");
            AddForeignKey("dbo.C002", "C001Id", "dbo.C001", "Id");
        }
    }
}
